package com.cqjtu.store.system.mapper;

import com.cqjtu.store.system.pojo.entity.ViewCnt;
import com.cqjtu.store.system.pojo.vo.FavoriteTopVo;
import com.cqjtu.store.system.pojo.vo.ViewCntProductVo;
import com.cqjtu.store.user.pojo.entity.User;
import org.apache.ibatis.annotations.Insert;
import org.apache.ibatis.annotations.Select;
import org.springframework.stereotype.Repository;

import java.util.List;

@Repository
public interface ViewCntMapper {


    List<ViewCntProductVo> loadProductCnt();

    @Insert("insert into view_cnt(user_id,product_id,category_id,type,create_time) " +
            "values (#{userId},#{productId},#{categoryId},#{type},now())")
    int insert(ViewCnt viewCnt);

    List<FavoriteTopVo> loadFavoriteCnt();

    @Select("select count(*) from t_order")
    Integer getOrderCnt();
    @Select("select sum(total_price) from t_order where DATE(pay_time) = CURDATE();")
    Integer getOrderToday();

    @Select("select sum(total_price) from t_order ;")
    Integer getOrderTotal();
    @Select("SELECT count(*) from t_product")
    Integer getProductTotal();
}
